package ggze;

import org.springframework.boot.SpringApplication;

import org.springframework.boot.autoconfigure.SpringBootApplication;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.thymeleaf.spring5.view.ThymeleafViewResolver;

import javax.annotation.Resource;
import java.util.LinkedHashMap;
import java.util.Map;
@EnableTransactionManagement
@SpringBootApplication
@EnableScheduling
//, "**.service.impl","ggze.actuator","**.timer"
@ComponentScan({"**.controller","ggze.actuator","**.service.impl"})
public class BootApplication {
    public static void main(String[] args) {
        SpringApplication application =new SpringApplication(BootApplication.class);
        application.addListeners(new ServerListenerBoot());
        application.run(args);
    }
    @Resource
    private Environment env;

    @Resource
    private void configureThymeleafStaticVars(ThymeleafViewResolver viewResolver) {
        if(viewResolver != null) {
            Map<String, String> vars = new LinkedHashMap<String,String>();
            vars.put("ctx", "旺财商城");
            vars.put("ctxName","旺财商城");
            vars.put("homeTitle","旺财商城");
            viewResolver.setStaticVariables(vars);
        }
    }
}
